Skip to main content

All Questions

Tagged with
0votes
0answers
747views

Designing a unique id reliably based on a String date?

I am creating an Android application that sets alarms based on the String date of a list of Objects (PendingIntents, with each taking in an id, that is an integer). In order to cancel the ...
Adam Lee's user avatar
0votes
1answer
312views

Hashset vs Treeset

I've always loved trees, that nice O(n*log(n)) and the tidiness of them. However, every software engineer I've ever known has asked me pointedly why I would use a TreeSet. From a CS background, I don'...
César Justiniano 's user avatar
17votes
6answers
9kviews

How to implement float hashing with approximate equality

Let's say we have the following Python class (the problem exists in Java just the same with equals and hashCode) class Temperature: def __init__(self, degrees): self.degrees = degrees ...
Marten's user avatar
1vote
2answers
1kviews

Map/store run time ID for objects

What I want to achieve: I need to obtain a run time (unique) id for "any object" (for classes either in java SE, classes I have created or classes provided by other third parties... any instance of a ...
Ordiel's user avatar
2votes
1answer
2kviews

If I am using just HashMap can I override only hashCode method?

If I need to use only HashMap, why do I need to override equals() method along with hashCode()? How will not implementing equals() affect the working of HashMap?
karan ratnaparkhi's user avatar
1vote
3answers
2kviews

Why would I need `equals` if I have already `hashcode`?

I got a question about why we need equals if we have hashcode. My first attempt was the answer because collision. But we corrected starting point with the assumption that we have not many objects so ...
Eugen Martynov's user avatar
5votes
0answers
299views

How to get a one-way hash function that is collision safe for about 1 million unique inputs? [duplicate]

Forgive me if this is a noob question - My CS education is a somewhat incomplete Basically, I need a way to hash an input, so that someone seeing the output doesn't see the original input value. ...
Eric S.'s user avatar
0votes
1answer
2kviews

Complexity of ArrayList of LinkedHashSet

I get input strings from the console like this: while ((currentLine = bufferedReader.readLine()) != null ) { StringTokenizer string = new StringTokenizer(currentLine, " "); while (string....
OiRc's user avatar
  • 127
2votes
2answers
6kviews

Design Hash table with simple hash function

I want to learn to Design Hash table with simple hash function for better understanding. I understand that the hash table will work as long as the hash function maps each key to a non-negative integer ...
KJC2009's user avatar
1vote
2answers
2kviews

Data Aggregation of CSV files java

I have k csv files (5 csv files for example), each file has m fields which produce a key and n values. I need to produce a single csv file with aggregated data. I'm looking for the most efficient ...
royB's user avatar
  • 217
5votes
6answers
3kviews

Would md5 hashes allow detection of synced files?

We have to develop our own file management system in Java web application. We need to sync files between our main server and client severs and find out whether all the client server has all the latest ...
codpursue's user avatar
7votes
8answers
7kviews

Using HashTable without overriding hashcode()

Today I was asked this question during an interview: What will happen if we do not override the hashcode method for our class, then add it to HashTable and then try to get objects? What could go ...
VextoR's user avatar
-3votes
2answers
2kviews

One global HashMap vs. many local HashMaps? [closed]

Which is more efficient; which is faster? Trade-offs? Goal is for fast look-ups in a web application. UUIDs are the keys, so global will work. Approx 50 million values. A global cache is ...
Tom Jones's user avatar

close